From f16291d45579da802c7011ea3220e07112ce35eb Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 28 Oct 2014 09:30:57 +0100 Subject: [PATCH] Fill `ops::registry::transmit` with the right value --- src/cargo/core/dependency.rs | 6 ++++++ src/cargo/ops/registry.rs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cargo/core/dependency.rs b/src/cargo/core/dependency.rs index ad814d6e4..fe83cf716 100644 --- a/src/cargo/core/dependency.rs +++ b/src/cargo/core/dependency.rs @@ -151,6 +151,12 @@ impl Dependency { &self.source_id == id.get_source_id())) } + /// If none, this dependencies must be built for all platforms. + /// If some, it must only be built for the specified platform. + pub fn get_only_for_platform(&self) -> Option<&str> { + self.only_for_platform.as_ref().map(|s| s.as_slice()) + } + /// Returns true if the dependency should be built for this platform. pub fn is_active_for_platform(&self, platform: &str) -> bool { match self.only_for_platform { diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index fbef2c629..9ffef7581 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -72,7 +72,7 @@ fn transmit(pkg: &Package, tarball: &Path, registry: &mut Registry) name: dep.get_name().to_string(), features: dep.get_features().to_vec(), version_req: dep.get_version_req().to_string(), - target: None, // FIXME: fill this out + target: dep.get_only_for_platform().map(|s| s.to_string()), } }).collect::>(); let manifest = pkg.get_manifest(); -- 2.30.2